SET NOCOUNT ON

BEGIN TRAN

BEGIN TRY

SELECT [FID]
      ,[FCompanyId]
      ,[FAccountId]
      ,[FAccount]
      ,[FLogonPass]
      ,[FNickname]
      ,[FStatus]
      ,[FIsAffiliate]
      ,[FIsTestAccount]
      ,[FEmail]
      ,[FPhoneNo]
      ,[FRealName]
      ,[FWithdrawalPass]
      ,[OperatorID]
      ,[FGradeID]
      ,[FIsBet]
      ,[FIsAgent]
      ,[FIsRegister]
      ,[FIsCommission]
      ,[FDefaultKickback]
      ,[IsChangeSubAccount]
      ,[IpAddress]
      ,[FHasContact]
      ,[FHasUserContact]
      ,[OperatorStatus]
      ,[FUpdateFinanceId]
      ,[FAddTime]
      ,[FUpdateTime]
      ,[FType]
      ,[FUseParentOdds]
INTO OfficialCashMid.dbo.[TAccountByFinanceParams]
FROM [OfficialCash20160805].[dbo].[TAccountByFinanceParams]


SELECT [FID]
      ,[FAccount]
      ,[FLogonPass]
      ,[FInsurePass]
      ,[FNickname]
      ,[FRegisterDate]
      ,[FLogonTimes]
      ,[FLastLogonDate]
      ,[FLastLogonIP]
      ,[FEmail]
      ,[FQQ]
      ,[FFaceImg]
      ,[FStatus]
      ,[FParentID]
      ,[FGradeID]
      ,[FCompanyID]
      ,[FHandicap]
      ,[FIsAffiliate]
      ,[FAdvanceEntertained]
      ,[FIsTestAccount]
      ,[FLastUpdateDate]
      ,[FApiPlatformId]
      ,[fForcesChangePWD]
      ,[FHierarchy]
      ,[FSubCount]
      ,[FIsBet]
      ,[FIsAgent]
      ,[FIsRegister]
      ,[FIsCommission]
      ,[FDefaultKickback]
      ,[FTotalGeneration]
      ,[FAgentType]
      ,[FHasContact]
      ,[FHasUserContact]
      ,[FIsMsgHigherUps]
      ,[FIsTransferAccounts]
INTO OfficialCashMid.dbo.[TAccounts]
FROM [OfficialCash20160805].[dbo].[TAccounts]


SELECT [FID]
      ,[FCreateTime]
      ,[FCompanyId]
      ,[FOperatorId]
      ,[FIp]
      ,[FModuleName]
      ,[FOperatorContent]
INTO OfficialCashMid.dbo.[TAdminOperationLog]
FROM [OfficialCash20160805].[dbo].[TAdminOperationLog]


SELECT [FId]
      ,[FCompanyId]
      ,[FAccountId]
      ,[FCurrencyId]
      ,[FRechargeType]
      ,[FRechargeAmount]
      ,[FRebate]
      ,[FRebateType]
      ,[FBalance]
      ,[FEffectiveAmount]
      ,[FChLimit]
      ,[FNoComLimit]
      ,[FComLimitAmount]
      ,[FBeginTime]
      ,[FEndTime]
      ,[FStatus]
      ,[FUpdateId]
      ,[FActivityID]
      ,[FActivityLock]
      ,[FJoinActivityID]
INTO OfficialCashMid.dbo.[TAudit]
FROM [OfficialCash20160805].[dbo].[TAudit]


SELECT [FAuditId]
      ,[FAuditName]
INTO OfficialCashMid.dbo.[TAuditOption]
FROM [OfficialCash20160805].[dbo].[TAuditOption]


SELECT [FId]
      ,[FCompanyId]
      ,[FGameId]
      ,[FGameName]
      ,[FDate]
      ,[FDisable]
      ,[FLastUpdateTime]
      ,[FLastUpdateUserId]
INTO OfficialCashMid.dbo.[TAutoAddPeriod]
FROM [OfficialCash20160805].[dbo].[TAutoAddPeriod]


SELECT [FID]
      ,[FGamePlayID]
      ,[FCompanyID]
      ,[FGameID]
      ,[FLastUpdateTime]
      ,[FLastUpdateUserID]
      ,[FLowestOdds]
      ,[FHighestOdds]
      ,[FDiffB]
      ,[FDiffC]
      ,[FDiffD]
      ,[Fcount]
      ,[FcountUpOdds]
      ,[fcountDownOdds]
      ,[fstopcount]
INTO OfficialCashMid.dbo.[TAutoOddsSetting]
FROM [OfficialCash20160805].[dbo].[TAutoOddsSetting]


SELECT [FID]
      ,[FAutoOddsSettingID]
      ,[FGamePlayItemId]
      ,[FMinAmount]
      ,[FMaxAmount]
      ,[FStepAmount]
      ,[FUnitDownOdds]
      ,[FUnitUpOdds]
      ,[FDownAmount]
      ,[FUpAmount]
      ,[FDiffB]
      ,[FDiffC]
      ,[FDiffD]
INTO OfficialCashMid.dbo.[TAutoOddsSettingItem]
FROM [OfficialCash20160805].[dbo].[TAutoOddsSettingItem]


SELECT [FID]
      ,[FCompanyID]
      ,[FPeriodID]
      ,[FAccountID]
      ,[FAccount]
      ,[FNickName]
      ,[FEffectiveMembers]
      ,[FPreviousTotalPayout]
      ,[FCurrentTotalPayout]
      ,[FSportsRebateProportion]
      ,[FLotteryRebateProportion]
      ,[FVideoRebateProportion]
      ,[FElectronicRebateProportion]
      ,[FPreviousTotalBet]
      ,[FCurrentTotalBet]
      ,[FSportsWaterProportion]
      ,[FLotteryWaterProportion]
      ,[FVideoWaterProportion]
      ,[FElectronicWaterProportion]
      ,[FPreviousTotalCost]
      ,[FCurrentTotalCost]
      ,[FReceiveCommission]
      ,[FHasCommission]
      ,[FStatus]
      ,[FCreateTime]
      ,[FOperatorID]
      ,[FIsCalculation]
      ,[FPreviousPeriod]
      ,[FSubsidyAmount]
      ,[FDayWages]
      ,[FOtherType]
      ,[FOtherDeduct]
      ,[FRemark]
INTO OfficialCashMid.dbo.[TBackCommission]
FROM [OfficialCash20160805].[dbo].[TBackCommission]


SELECT [FPeriodID]
      ,[FAccountID]
      ,[FSportsPayout]
      ,[FLotteryPayout]
      ,[FVideoPayout]
      ,[FElectronicPayout]
      ,[FSportsBet]
      ,[FLotteryBet]
      ,[FVideoBet]
      ,[FElectronicBet]
INTO OfficialCashMid.dbo.[TBackCommissionAssist]
FROM [OfficialCash20160805].[dbo].[TBackCommissionAssist]


SELECT [FBackWaterID]
      ,[FAccountID]
      ,[FParentID]
      ,[FParentAccount]
      ,[FAccount]
      ,[FEffectstakeTotalBet]
      ,[FSportsBet]
      ,[FLotteryBet]
      ,[FVideoBet]
      ,[FElectronicBet]
      ,[FSportsRebate]
      ,[FLotteryRebate]
      ,[FVideoRebate]
      ,[FElectronicRebate]
      ,[FTotalRebate]
      ,[FStatus]
INTO OfficialCashMid.dbo.[TBackWaterDetails]
FROM [OfficialCash20160805].[dbo].[TBackWaterDetails]


SELECT [FID]
      ,[FAccountID]
      ,[FBankID]
      ,[FBankName]
      ,[FCardNo]
      ,[FHolders]
      ,[FProvince]
      ,[FCity]
      ,[FBranch]
      ,[FGroupID]
      ,[FDisableAmount]
      ,[FStatus]
      ,[FRemark]
      ,[FAddTime]
      ,[FUpdateTime]
      ,[FCurrentAmount]
      ,[FTotalAmount]
      ,[FUpdateAccountId]
      ,[FPhoneNo]
INTO OfficialCashMid.dbo.[TBankCards]
FROM [OfficialCash20160805].[dbo].[TBankCards]


SELECT [FID]
      ,[FName]
      ,[FWebsite]
      ,[FStatus]
      ,[FIsMainBank]
INTO OfficialCashMid.dbo.[TBanks]
FROM [OfficialCash20160805].[dbo].[TBanks]


SELECT [FID]
      ,[FGameID]
      ,[FCompanyID]
      ,[FPeriodID]
      ,[FPosition]
      ,[FGoal]
      ,[FBetAmount]
      ,[FLoseValue]
INTO OfficialCashMid.dbo.[TBetAnalysis]
FROM [OfficialCash20160805].[dbo].[TBetAnalysis]


SELECT [FId]
      ,[FCompanyId]
      ,[FCardNO]
      ,[FAddTime]
      ,[FOperatorId]
      ,[FRemark]
INTO OfficialCashMid.dbo.[TCardsBlacklist]
FROM [OfficialCash20160805].[dbo].[TCardsBlacklist]


SELECT [FId]
      ,[FCompanyId]
      ,[FCurrencyId]
      ,[FIsTemple]
      ,[FName]
      ,[FUpdateTime]
      ,[FUpdateUserId]
INTO OfficialCashMid.dbo.[TCashConfig]
FROM [OfficialCash20160805].[dbo].[TCashConfig]


SELECT [FId]
      ,[FName]
      ,[FType]
      ,[FParentId]
      ,[FGroup]
INTO OfficialCashMid.dbo.[TCashFlowType]
FROM [OfficialCash20160805].[dbo].[TCashFlowType]


SELECT [FId]
      ,[FCashConfigId]
      ,[FCompanyId]
      ,[FIsChargeFree]
      ,[FFreeHours]
      ,[FFreeTimes]
      ,[FEncashmentCharge]
      ,[FUpdateTime]
      ,[FUpdateUserId]
INTO OfficialCashMid.dbo.[TChargeConfig]
FROM [OfficialCash20160805].[dbo].[TChargeConfig]


SELECT TOP 1000 [FID]
      ,[FAccountId]
      ,[FCompanyID]
      ,[FCreateTime]
      ,[FUpdateTime]
      ,[FAccountList]
INTO OfficialCashMid.dbo.[TChildAccountSeeConstraint]
FROM [OfficialCash20160805].[dbo].[TChildAccountSeeConstraint]


SELECT [FID]
      ,[FCompanyID]
      ,[FHierarchy]
      ,[FProfitAmount]
      ,[FCommissionBetAmount]
      ,[FEffectiveMembers]
      ,[FSportsRebateProportion]
      ,[FLotteryRebateProportion]
      ,[FVideoRebateProportion]
      ,[FElectronicRebateProportion]
      ,[FEffectiveAmount]
      ,[FSportsWaterProportion]
      ,[FLotteryWaterProportion]
      ,[FVideoWaterProportion]
      ,[FElectronicWaterProportion]
      ,[FAgentIds]
      ,[FGameIds]
INTO OfficialCashMid.dbo.[TCommission]
FROM [OfficialCash20160805].[dbo].[TCommission]


SELECT [FID]
      ,[FCompanyID]
      ,[FPeriodName]
      ,[FStartDate]
      ,[FEndDate]
      ,[FIsVisible]
      ,[FStatus]
      ,[FCreateTime]
      ,[FType]
INTO OfficialCashMid.dbo.[TCommissionPeriod]
FROM [OfficialCash20160805].[dbo].[TCommissionPeriod]


SELECT [FId]
      ,[FType]
      ,[FUserID]
      ,[FBalance]
      ,[FFreeBalance]
      ,[FAstrictBalance]
      ,[FFrozenBalance]
      ,[FGiveBalance]
      ,[FOperatorID]
INTO OfficialCashMid.dbo.[TCredits]
FROM [OfficialCash20160805].[dbo].[TCredits]


SELECT [FId]
      ,[FChineseName]
      ,[FEnglishName]
      ,[FCode]
INTO OfficialCashMid.dbo.[TCurrency]
FROM [OfficialCash20160805].[dbo].[TCurrency]


SELECT [FID]
      ,[FUserID]
      ,[FCompanyID]
      ,[FGameID]
      ,[FGamePlayID]
      ,[FGamePlayItemID]
      ,[FMinOdds]
      ,[FMaxOdds]
      ,[FCompanyKickback]
      ,[FMaxKickback]
      ,[FMaxKickLock]
      ,[FIsLock]
      ,[FBlockadeValue]
      ,[FBroadenValue]
      ,[FStopBet]
      ,[FCreateTime]
      ,[FUpdateTime]
      ,[FOperatorID]
INTO OfficialCashMid.dbo.[TDefaultOdds]
FROM [OfficialCash20160805].[dbo].[TDefaultOdds]


SELECT [FID]
      ,[FCompanyID]
      ,[FParentId]
      ,[FAccountID]
      ,[FSerialNumber]
      ,[FReceiptBank]
      ,[FUserBank]
      ,[FDepositTime]
      ,[FRemittanceWay]
      ,[FRemittancePerson]
      ,[FRemittancePlace]
      ,[FRemittanceType]
      ,[FPaymentProviderId]
      ,[FAmount]
      ,[FRebate]
      ,[FBeforeBalance]
      ,[FAfterBalance]
      ,[FStatus]
      ,[FIsFirst]
      ,[FUpdateTime]
      ,[FUpdateUserId]
      ,[FDepositType]
INTO OfficialCashMid.dbo.[TDeposit]
FROM [OfficialCash20160805].[dbo].[TDeposit]


SELECT [FID]
      ,[FCompanyID]
      ,[FAccountID]
      ,[FSerialNumber]
      ,[FBankCardId]
      ,[FApplyAmount]
      ,[FStatus]
      ,[FFirstEncashment]
      ,[FCharge]
      ,[FPrivilege]
      ,[FAdminCharge]
      ,[FOutAmount]
      ,[FPrivilegeDeduct]
      ,[FBeforeBalance]
      ,[FAfterBalance]
      ,[FApplyTime]
      ,[FUpdateTime]
      ,[FUpdateUserId]
      ,[FRemark]
      ,[FRiskStatus]
      ,[FRiskRemark]
      ,[FRiskOperatorId]
      ,[FHasJoinActivity]
      ,[FAutoAuditStatus]
      ,[FFalsifyMs]
      ,[FRiskOperatorTime]
INTO OfficialCashMid.dbo.[TEncashment]
FROM [OfficialCash20160805].[dbo].[TEncashment]


SELECT [FID]
      ,[FAccountID]
      ,[FAccountName]
      ,[FCompanyID]
      ,[FMessage]
      ,[FException]
      ,[FClassName]
      ,[FFunctionName]
      ,[FCreateTime]
      ,[FRemark]
      ,[FRequestURL]
      ,[FIP]
      ,[FType]
INTO OfficialCashMid.dbo.[TExceptionLog]
FROM [OfficialCash20160805].[dbo].[TExceptionLog]


SELECT [FID]
      ,[FName]
      ,[FAddTime]
      ,[FSessionID]
      ,[FSPID]
      ,[FLaseUpdateTime]
      ,[FLaseUpdateSessionID]
      ,[FLaseUpdateSPID]
      ,[FRemark]
INTO OfficialCashMid.dbo.[TFineUI]
FROM [OfficialCash20160805].[dbo].[TFineUI]


SELECT [FID]
      ,[FCategoryName]
      ,[FCategoryCode]
      ,[FGroupID]
      ,[FSort]
INTO OfficialCashMid.dbo.[TGameCategory]
FROM [OfficialCash20160805].[dbo].[TGameCategory]


SELECT [FID]
      ,[FName]
      ,[FSeq]
      ,[FAssemblyName]
      ,[FFullClassName]
      ,[FInterfaceName]
      ,[FGamePlayConcreteKey]
      ,[FSettlementConcreteKey]
      ,[FCalculatorConcreteKey]
      ,[FGroupID]
      ,[FIsEnabled]
      ,[FReportDBName]
      ,[FGoalValidateExpression]
      ,[FAllowRepeatNumber]
      ,[FEffectstakeConcreteKey]
      ,[FPeriodCount]
      ,[FLotteryCode]
      ,[FAutoBuildDays]
      ,[FCalculatorBetNumberKey]
      ,[FBaseGameID]
      ,[FGameCode]
      ,[FGameCategoryID]
      ,[FOfficialWebSite]
      ,[FGetWaterUrl]
      ,[FAbbreviation]
      ,[FLotteryCodeCount]
      ,[FCollectRule]
      ,[FPeriodRule]
INTO OfficialCashMid.dbo.[TGameInfo]
FROM [OfficialCash20160805].[dbo].[TGameInfo]


SELECT [Id]
      ,[FAccountID]
      ,[CustomerType]
      ,[LinkValidityPeriod]
      ,[CreateLink]
      ,[AddTime]
      ,[AccessQuantity]
      ,[RegistrationNumber]
      ,[FDefaultKickback]
      ,[GMId]
      ,[FCompanyID]
INTO OfficialCashMid.dbo.[TGeneralize]
FROM [OfficialCash20160805].[dbo].[TGeneralize]


SELECT [FID]
      ,[FName]
      ,[FParentID]
      ,[FLevel]
      ,[FCompanyID]
      ,[FIsOperable]
      ,[FIsRiskOpened]
      ,[FIsForceRatio]
      ,[FAccountPrefix]
      ,[FIsRiskOpenedRatio]
INTO OfficialCashMid.dbo.[TGrade]
FROM [OfficialCash20160805].[dbo].[TGrade]


SELECT [FID]
      ,[FCompanyID]
      ,[FGameID]
      ,[FPeriodDate]
INTO OfficialCashMid.dbo.[THasPeriod]
FROM [OfficialCash20160805].[dbo].[THasPeriod]


SELECT [FID]
      ,[FCompanyID]
      ,[FOnlineCount]
      ,[FOwnerID]
      ,[FCreatedDate]
      ,[FOnlineShowTime]
      ,[FVisitCount]
      ,[FVisitedShowTime]
INTO OfficialCashMid.dbo.[THighestOnlineUser]
FROM [OfficialCash20160805].[dbo].[THighestOnlineUser]


SELECT [FId]
      ,[FParentId]
      ,[FAccountId]
      ,[FCompanyId]
      ,[FActivityId]
      ,[FStatus]
      ,[FAmount]
      ,[FReferenceAmt]
      ,[FIsAutoAudit]
      ,[FRemark]
      ,[FAddTime]
      ,[FUpdateTime]
      ,[FOperatorId]
      ,[FIp]
      ,[FUpdateFinanceId]
INTO OfficialCashMid.dbo.[TJoinActivityRecord]
FROM [OfficialCash20160805].[dbo].[TJoinActivityRecord]


SELECT [FUserID]
      ,[FGameID]
      ,[FGamePlayID]
      ,[FKickbackA]
      ,[FKickbackB]
      ,[FKickbackC]
      ,[FKickbackD]
      ,[FOperatorID]
INTO OfficialCashMid.dbo.[TKickback]
FROM [OfficialCash20160805].[dbo].[TKickback]


SELECT [FGameID]
      ,[FGamePlayID]
      ,[FUserID]
      ,[FLowest]
      ,[FHighest]
      ,[FItemHighest]
      ,[FOperatorID]
INTO OfficialCashMid.dbo.[TLimitAmount]
FROM [OfficialCash20160805].[dbo].[TLimitAmount]


SELECT [FId]
      ,[FCompanyId]
      ,[FAccountId]
      ,[FWebSite]
      ,[FLoginTime]
      ,[FIp]
      ,[FIpCity]
      ,[FStatus]
      ,[FFailDescript]
      ,[FWebType]
INTO OfficialCashMid.dbo.[TLoginLog]
FROM [OfficialCash20160805].[dbo].[TLoginLog]


SELECT [FId]
      ,[FType]
      ,[FDescript]
      ,[FDateTime]
      ,[FUserId]
INTO OfficialCashMid.dbo.[TLogs]
FROM [OfficialCash20160805].[dbo].[TLogs]


SELECT [ID]
      ,[GameID]
      ,[NumberOfPeriod]
      ,[CompanyID]
      ,[Result]
      ,[CreateTime]
      ,[LastUpdateTime]
INTO OfficialCashMid.dbo.[TLotteryResults]
FROM [OfficialCash20160805].[dbo].[TLotteryResults]


SELECT [FID]
      ,[FCompanyID]
      ,[FName]
      ,[FDescription]
      ,[FDepositCount]
      ,[FDepositAmount]
      ,[FMaxDepositAmount]
      ,[FDrawingCount]
      ,[FDrawingAmount]
      ,[FHighestAmount]
      ,[FLowestAmount]
      ,[FPaymentDrawingAmount]
      ,[FCompanyDrawingAmount]
      ,[FRemark]
INTO OfficialCashMid.dbo.[TMemberGroups]
FROM [OfficialCash20160805].[dbo].[TMemberGroups]


SELECT [FId]
      ,[FCompanyId]
      ,[FAccountId]
      ,[FCurrency]
      ,[FReasonType]
      ,[FDepositOrWithdraw]
      ,[FAmount]
      ,[FRebateCharge]
      ,[FBalance]
      ,[FDetailId]
      ,[FDateTime]
      ,[FRemark]
      ,[FUpdateId]
      ,[FActivityType]
      ,[FOrderNumber]
      ,[FPeriodId]
      ,[FPeriodNumber]
      ,[FGameId]
      ,[FGameName]
      ,[FGamePlayId]
      ,[FGamePlayName]
INTO OfficialCashMid.dbo.[TMoneyChanges]
FROM [OfficialCash20160805].[dbo].[TMoneyChanges]


SELECT [FID]
      ,[FCompanyID]
      ,[FPeriodID]
      ,[FGameID]
      ,[FGamePlayID]
      ,[FGamePlayItemID]
      ,[FOddDiff]
      ,[FUpdateID]
      ,[FUpdateTime]
INTO OfficialCashMid.dbo.[TOddsChange]
FROM [OfficialCash20160805].[dbo].[TOddsChange]


SELECT [FGamePlayItemID]
      ,[FCompanyID]
      ,[FGoal]
      ,[FGameID]
      ,[FGamePlayID]
      ,[FLastUpdateTime]
      ,[FLastUpdateUserID]
      ,[FOdds]
INTO OfficialCashMid.dbo.[TOddsSetting]
FROM [OfficialCash20160805].[dbo].[TOddsSetting]


SELECT [FId]
      ,[FCompanyId]
      ,[FPayMerId]
      ,[FAccountId]
      ,[FAmount]
      ,[FRebate]
      ,[FBillNO]
      ,[FMercode]
      ,[FCurrencyType]
      ,[FBankMsg]
      ,[FAttach]
      ,[FIPSbillno]
      ,[FRetenCodeType]
      ,[FBankbillno]
      ,[FCreateTime]
      ,[FUpdateTime]
      ,[FStatus]
      ,[FStrpSign]
      ,[FOperatorId]
      ,[FIsFirst]
INTO OfficialCashMid.dbo.[TOnlinePayOrder]
FROM [OfficialCash20160805].[dbo].[TOnlinePayOrder]


SELECT [FID]
      ,[FOrderID]
      ,[FGamePlayItemID]
      ,[FODDS]
      ,[FODDS1]
      ,[FODDS2]
      ,[FKickback]
      ,[FMaxKickback]
      ,[FStatus]
      ,[FRemark]
      ,[FUpdateUserID]
      ,[FWinningCount]
      ,[FBettingBalance]
      ,[FResult]
INTO OfficialCashMid.dbo.[TOrderDetails]
FROM [OfficialCash20160805].[dbo].[TOrderDetails]


SELECT [FID]
      ,[FOrderNumber]
      ,[FGameID]
      ,[FUserID]
      ,[FPeriodID]
      ,[FNumberOfPeriod]
      ,[FCreateTime]
      ,[FStatus]
      ,[FTotalAmount]
      ,[FGamePlayID]
      ,[FGamePlayName]
      ,[FFirstAwardId]
      ,[FGoal]
      ,[FContent]
      ,[FTimes]
      ,[FBetNumber]
      ,[FMoneyModel]
      ,[FItemCount]
      ,[FCompanyID]
      ,[FRemark]
      ,[hasAssist]
      ,[FIsTrack]
      ,[FPlatform]
      ,[FIpAddress]
      ,[FSettleTime]
INTO OfficialCashMid.dbo.[TOrders]
FROM [OfficialCash20160805].[dbo].[TOrders]


SELECT [FOrderID]
      ,[FUserID]
      ,[FCompanyID]
      ,[FPeriodID]
      ,[FAmount]
      ,[FBettingBalance]
      ,[FTotalKickback]
      ,[FSettleBalance]
      ,[FWinningCount]
INTO OfficialCashMid.dbo.[TOrderSettlement]
FROM [OfficialCash20160805].[dbo].[TOrderSettlement]


SELECT [FID]
      ,[FGameId]
      ,[FParentId]
      ,[FName]
      ,[FShowGroup]
      ,[FSeq]
      ,[FMethod]
      ,[FHasCountOdds]
      ,[FIsEnable]
      ,[FTempId]
      ,[FShowFirstItemName]
INTO OfficialCashMid.dbo.[TOtherGamePlay]
FROM [OfficialCash20160805].[dbo].[TOtherGamePlay]


SELECT [FID]
      ,[FGamePlayID]
      ,[FName]
      ,[FKeyName]
      ,[FNumber]
      ,[FSort]
      ,[FMethod]
      ,[FTogether]
      ,[FNegative]
      ,[FHitRate]
      ,[FHitCount]
      ,[FAllBalls]
      ,[FAwardLevel]
      ,[FFirstAwardId]
      ,[FValidRegex]
      ,[FIsEnable]
      ,[FSettlementID]
INTO OfficialCashMid.dbo.[TOtherGamePlayItem]
FROM [OfficialCash20160805].[dbo].[TOtherGamePlayItem]


SELECT [FID]
      ,[FGameId]
      ,[FNumberOfPeriod]
      ,[FStartTime]
      ,[FLottoStartDate]
      ,[FLottoStartTime]
      ,[FCloseTime]
      ,[FStatus]
      ,[FCodeResult]
      ,[FCreatorID]
      ,[FCreateTime]
      ,[FLastUpdateUserID]
      ,[FLastUpdateTime]
      ,[FCompanyID]
      ,[FSum]
      ,[FSingularAndEven]
      ,[FLargeAndSmall]
      ,[FHLargeAndSmall]
      ,[FIsExported]
      ,[FIsRist]
      ,[FCompResult]
      ,[XmlStatus]
      ,[FIsReduction]
      ,[FhasOdds]
      ,[FSettleTime]
      ,[FSettleCount]
      ,[FIsRead]
      ,[FReadUserID]
      ,[FRiskOddsStatus]
      ,[FIsReSettle]
      ,[FSettleDateTime]
INTO OfficialCashMid.dbo.[TOtherPeriod]
FROM [OfficialCash20160805].[dbo].[TOtherPeriod]


SELECT [FID]
      ,[FCompanyID]
      ,[FMerchantId]
      ,[FMerchantName]
      ,[FMerchantCode]
      ,[FMerchantAccount]
      ,[FMerchantKey]
      ,[FMemberGroupID]
      ,[FDisableAmount]
      ,[FCardType]
      ,[FOrder]
      ,[FStatus]
      ,[FLastUpdateUserId]
      ,[FLastUpdateTime]
      ,[FCurrentAmount]
      ,[FTotalAmount]
      ,[FPayBuildDomain]
      ,[FPayBackDomain]
      ,[FEncryptionPassword]
INTO OfficialCashMid.dbo.[TPaymentProvider]
FROM [OfficialCash20160805].[dbo].[TPaymentProvider]


SELECT [FID]
      ,[FPeriodID]
      ,[FGameID]
      ,[FCompanyID]
      ,[FGameName]
      ,[FNumberOfPeriod]
      ,[FCodeResult]
      ,[FStartTime]
      ,[FCloseTime]
      ,[FLottoStartTime]
      ,[FTotalAccount]
      ,[FTotalCount]
      ,[FTotalAmount]
      ,[FTotalWinAmount]
      ,[FTotalKickback]
      ,[FTotalDiffKickback]
      ,[FBetModel]
      ,[FSettleResult]
      ,[FCreateTime]
INTO OfficialCashMid.dbo.[TPeriodReport]
FROM [OfficialCash20160805].[dbo].[TPeriodReport]


SELECT [FID]
      ,[FPeriodsNumber]
      ,[FGameId]
      ,[FOpenTime]
      ,[FOpenTimeDays]
      ,[FCloseTime]
      ,[FCloseTimeDays]
      ,[FOpenResultTime]
      ,[FOpenResultTimeDays]
      ,[FOrderNum]
      ,[FCreateTime]
      ,[FUpdateTime]
      ,[FIsEnabled]
INTO OfficialCashMid.dbo.[TPeriodsTemplate]
FROM [OfficialCash20160805].[dbo].[TPeriodsTemplate]


SELECT [FId]
      ,[FName]
      ,[FKey]
      ,[FGameId]
      ,[FPlayIds]
INTO OfficialCashMid.dbo.[TPlayGroup]
FROM [OfficialCash20160805].[dbo].[TPlayGroup]


SELECT [FId]
      ,[FCashConfigId]
      ,[FCompanyId]
      ,[FCashFlowTypeId]
      ,[FRechargePrivilege]
      ,[FPreferenceLine]
      ,[FPreferencePercent]
      ,[FPreferenceCoefficient]
      ,[FRechargeMax]
      ,[FRechargeMin]
      ,[FPreferenceMax]
      ,[FOtherPreferenceLine]
      ,[FOtherPreferencePercent]
      ,[FOtherPreferenceMax]
      ,[FOtherDayPreferenceMax]
      ,[FEncashmentMax]
      ,[FEncashmentMin]
      ,[FOpenGameLimit]
      ,[FGameLimit]
      ,[FOpenSportLimit]
      ,[FSportLimit]
      ,[FOpenLotteryLimit]
      ,[FLotteryLimit]
      ,[FOpenCHLimit]
      ,[FCHLimit]
      ,[FOpenComLimit]
      ,[FComLimit]
      ,[FPreferenceBalanceLimit]
      ,[FLimitRelax]
      ,[FLimitAdminChargePercent]
      ,[FUpdateTime]
      ,[FUpdateUserId]
INTO OfficialCashMid.dbo.[TPreferenceConfig]
FROM [OfficialCash20160805].[dbo].[TPreferenceConfig]


SELECT [ID]
      ,[CompanyID]
      ,[MerchantID]
      ,[UserID]
      ,[SerialKey]
      ,[DepositFlag]
      ,[Amount]
      ,[Balance]
      ,[OperationTime]
      ,[Remark]
INTO OfficialCashMid.dbo.[TProxyCashFlow]
FROM [OfficialCash20160805].[dbo].[TProxyCashFlow]


SELECT [FID]
      ,[FCompanyID]
      ,[FGameID]
      ,[FUpdatedID]
      ,[FForRatio]
      ,[FCurrentRatio]
      ,[FIsRatioControl]
      ,[FCurrentIsRatioControl]
      ,[FRecordTime]
      ,[FOperatorID]
      ,[FType]
INTO OfficialCashMid.dbo.[TRatioControlLog]
FROM [OfficialCash20160805].[dbo].[TRatioControlLog]


SELECT [FID]
      ,[FCompanyID]
      ,[FGameID]
      ,[FOperatorID]
      ,[FUpdatedID]
      ,[FForRatio]
      ,[FCurrentRatio]
      ,[FSubForRatio]
      ,[FSubCurrentRatio]
      ,[FSubForForceRatio]
      ,[FSubCurrentForceRatio]
      ,[FRecordTime]
      ,[FIP]
      ,[FType]
INTO OfficialCashMid.dbo.[TRatioLog]
FROM [OfficialCash20160805].[dbo].[TRatioLog]


SELECT [FId]
      ,[FName]
      ,[FCompanyId]
      ,[FUpdateTime]
      ,[FUpdateUserId]
      ,[FStatus]
      ,[FlimitType]
      ,[FBeginTime]
      ,[FEndTime]
      ,[FActivityTypeId]
      ,[FActivitySubTypeId]
      ,[FRechargeMode]
      ,[FGetMode]
      ,[FCreateUserId]
      ,[FAddTime]
      ,[FActivityContext]
      ,[FAuditOption]
      ,[FIsLimitPercent]
      ,[FLimitPercent]
      ,[FIsRebateLimit]
      ,[FRebateLimitMin]
      ,[FRebateLimitMax]
      ,[FIsLimitIP]
      ,[FIpArray]
      ,[FActivityListSort]
      ,[FReceiveNumber]
      ,[FSingleBonusAmount]
      ,[FSingleBonusLimit]
      ,[FIsSetTotalAmount]
      ,[FBonusTotalAmount]
      ,[FIsSetSingleAmount]
      ,[FApplyCount]
      ,[FThroughCount]
      ,[FTotalThroughAmount]
      ,[FIntervalTime]
      ,[FActivityMode]
      ,[FGameIds]
      ,[FFirstAgentIds]
INTO OfficialCashMid.dbo.[TRebateActivities]
FROM [OfficialCash20160805].[dbo].[TRebateActivities]


SELECT [FId]
      ,[FActivityId]
      ,[FMin]
      ,[FMax]
      ,[FRebatePercent]
      ,[FIsRebatePercent]
      ,[FLimitPercent]
      ,[FIsLimitPercent]
      ,[FAwardPercent]
      ,[FIsAwardPercent]
      ,[FUpdateTime]
      ,[FUpdateUserId]
INTO OfficialCashMid.dbo.[TRebateActivitiesDetail]
FROM [OfficialCash20160805].[dbo].[TRebateActivitiesDetail]


SELECT [FId]
      ,[FCompanyId]
      ,[FGameId]
      ,[FPlayId]
      ,[FPlayItemId]
      ,[FPeriodId]
      ,[FTotalAmount]
      ,[FIsLock]
      ,[FUpdateTime]
INTO OfficialCashMid.dbo.[TReceiveAmount]
FROM [OfficialCash20160805].[dbo].[TReceiveAmount]


SELECT [FUserID]
      ,[FGameID]
      ,[FGamePlayID]
      ,[FPeriodID]
      ,[FOrderCount]
      ,[FStake]
      ,[FEffectStake]
      ,[FBettingBalance]
      ,[FTotalKickback]
      ,[FSettleResult]
      ,[FBalanceSettleResult]
      ,[FWinningAmount]
      ,[FDiffKickback]
      ,[FTeamOrderCount]
      ,[FTeamTotalStake]
      ,[FTeamTotalEffectStake]
      ,[FTeamBettingBalance]
      ,[FTeamTotalKickback]
      ,[FTeamTotalSettleResult]
      ,[FTemTotalBalanceSettleResult]
      ,[FTeamWinningAmount]
      ,[FTeamDiffKickback]
      ,[FCompanyID]
      ,[FCreateTime]
INTO OfficialCashMid.dbo.[TSettlement]
FROM [OfficialCash20160805].[dbo].[TSettlement]


SELECT [FGameID]
      ,[FGamePlayID]
      ,[FPeriodID]
      ,[FUserID]
      ,[FSubAccountID]
      ,[FDiffKickback]
      ,[FMinRatio]
      ,[FMaxRatio]
      ,[FRatioBalance]
      ,[FRatioKickback]
      ,[FRatioResult]
      ,[FRealDiffKickback]
      ,[FDiff]
      ,[FAmount]
      ,[FResult]
      ,[FTotalResult]
      ,[FTotalSettleAmount]
      ,[FCompanyID]
      ,[FLowerVolume]
      ,[FHigherVolume]
      ,[FLowerCommission]
      ,[FHigherCommission]
INTO OfficialCashMid.dbo.[TSettlementAssist]
FROM [OfficialCash20160805].[dbo].[TSettlementAssist]


SELECT [FID]
      ,[FName]
      ,[FParentId]
      ,[FGroupName]
      ,[FShowGroup]
      ,[FSeq]
      ,[FMethod]
      ,[FIsEnable]
      ,[FTempId]
INTO OfficialCashMid.dbo.[TSixGamePlay]
FROM [OfficialCash20160805].[dbo].[TSixGamePlay]


SELECT [FID]
      ,[FGamePlayID]
      ,[FName]
      ,[FKeyName]
      ,[FNumber]
      ,[FSort]
      ,[FMethod]
      ,[FTogether]
      ,[FNegative]
      ,[FHitRate]
      ,[FHitCount]
      ,[FAllBalls]
      ,[FAwardLevel]
      ,[FFirstAwardId]
      ,[FValidRegex]
      ,[FIsEnable]
      ,[FSettlementID]
INTO OfficialCashMid.dbo.[TSixGamePlayItem]
FROM [OfficialCash20160805].[dbo].[TSixGamePlayItem]


SELECT [FID]
      ,[FNumberOfPeriod]
      ,[FStartTime]
      ,[FLottoStartTime]
      ,[FLottoStartDate]
      ,[FSpecialCodeCloseTime]
      ,[FCodeCloseTime]
      ,[FCodeStatus]
      ,[FEvenCodeCloseTime]
      ,[FEvenCodeStatus]
      ,[FBothSideCodeCloseTime]
      ,[FBothSideCodeStatus]
      ,[FStatus]
      ,[FCreatorID]
      ,[FCreateTime]
      ,[FLastUpdateUserID]
      ,[FLastUpdateTime]
      ,[FCompanyID]
      ,[FFirstCodeResult]
      ,[FFirstCodeAnimal]
      ,[FSecondCodeResult]
      ,[FSecondCodeAnimal]
      ,[FThirdCodeResult]
      ,[FThirdCodeAnimal]
      ,[FFourthCodeResult]
      ,[FFourthCodeAnimal]
      ,[FFifthCodeResult]
      ,[FFifthCodeAnimal]
      ,[FSixthCodeResult]
      ,[FSixthCodeAnimal]
      ,[FSpecialCodeResult]
      ,[FSpecialCodeAnimal]
      ,[F7Sum]
      ,[F7SingularAndEven]
      ,[F7LargeAndSmall]
      ,[FSingularAndEven]
      ,[FLargeAndSmall]
      ,[FHSingularAndEven]
      ,[FHLargeAndSmall]
      ,[FHWLargeAndSmall]
      ,[FPoultryAndBeast]
      ,[FColor]
      ,[FIsExported]
      ,[FCompResult]
      ,[XmlStatus]
      ,[FIsReduction]
      ,[FSettleTime]
      ,[FSettleCount]
      ,[FIsReSettle]
      ,[FSettleDateTime]
INTO OfficialCashMid.dbo.[TSixPeriod]
FROM [OfficialCash20160805].[dbo].[TSixPeriod]


SELECT [FID]
      ,[FOperatorID]
      ,[FUpdatedID]
      ,[FCompanyID]
      ,[FRecordTime]
      ,[FContent]
      ,[FIP]
      ,[FType]
      ,[FKey]
      ,[FTType]
INTO OfficialCashMid.dbo.[TSystemLog]
FROM [OfficialCash20160805].[dbo].[TSystemLog]


SELECT [FId]
      ,[FTrackNumber]
      ,[FCompanyId]
      ,[FAccountId]
      ,[FGameId]
      ,[FStartPeriodId]
      ,[FStartNumberOfPeriod]
      ,[FPlayId]
      ,[FPlayName]
      ,[FPlayItemId]
      ,[FContent]
      ,[FMoneyModel]
      ,[FBetNumber]
      ,[FKickback]
      ,[FCancelCount]
      ,[FWinCount]
      ,[FIsWinStop]
      ,[FSkipStop]
      ,[FPeriodsCount]
      ,[FAmountSum]
      ,[FWinAmount]
      ,[FFinishPeriods]
      ,[FFinishAmount]
      ,[FCancelAmount]
      ,[FStatus]
      ,[FCreateTime]
      ,[FUpdateTime]
      ,[FUpdateAccountId]
      ,[FIpAddress]
      ,[FPlatform]
INTO OfficialCashMid.dbo.[TTrackBet]
FROM [OfficialCash20160805].[dbo].[TTrackBet]


SELECT [FId]
      ,[FTrackId]
      ,[FPeriodId]
      ,[FNumberOfPeriod]
      ,[FTimes]
      ,[FAmount]
      ,[FStatus]
      ,[FOrderId]
      ,[FHasOrder]
      ,[FCreteTime]
      ,[FUpdateTime]
      ,[FUserId]
      ,[FRemark]
INTO OfficialCashMid.dbo.[TTrackDetails]
FROM [OfficialCash20160805].[dbo].[TTrackDetails]


SELECT [FId]
      ,[FGameId]
      ,[FPeriodId]
      ,[FCompanyID]
      ,[FGamePlayId]
      ,[FGamePlayIdItemId]
      ,[FOldOdds]
      ,[FNewOdds]
      ,[FUser]
      ,[FUpdateTime]
      ,[fdownType]
INTO OfficialCashMid.dbo.[TTraderLog]
FROM [OfficialCash20160805].[dbo].[TTraderLog]


SELECT [FGameID]
      ,[FUserID]
      ,[FParentMaxRatio]
      ,[FParentMinRatio]
      ,[FSelfRatio]
      ,[FIsEnabled]
      ,[FIsForceRatio]
      ,[FIsRatioControl]
      ,[FRemnantRatioTarget]
      ,[FIsOperable]
      ,[FXYHandicap]
      ,[FOperatorID]
      ,[FUpdateTime]
INTO OfficialCashMid.dbo.[TUserAndGame]
FROM [OfficialCash20160805].[dbo].[TUserAndGame]


SELECT [FGameID]
      ,[FUserID]
      ,[FGamePlayID]
      ,[FGamePlayItemID]
      ,[FPeriodID]
      ,[FGoal]
      ,[FCompanyID]
      ,[FLastUpdateTime]
      ,[FOdds]
      ,[FOddsB]
      ,[FOddsC]
      ,[FOddsD]
      ,[FIsRist]
INTO OfficialCashMid.dbo.[TUserGameOddsSetting]
FROM [OfficialCash20160805].[dbo].[TUserGameOddsSetting]


SELECT [FId]
      ,[FTypeId]
      ,[FDetailId]
      ,[FAmount]
      ,[FFreeAmount]
      ,[FAstrictAmount]
      ,[FGiveBalance]
      ,[FStatus]
      ,[FUpdateTime]
      ,[FOperatorId]
      ,[FAccountId]
      ,[FCompanyId]
INTO OfficialCashMid.dbo.[TWithholding]
FROM [OfficialCash20160805].[dbo].[TWithholding]



COMMIT TRAN
END TRY
BEGIN CATCH
	ROLLBACK TRAN 
END CATCH 

